/**
 *             _..--""-.                  .-""--.._
           _.-'         \ __...----...__ /         '-._
         .'      .:::...,'              ',...:::.      '.
        (     .'``'''::;                  ;::'''``'.     )
         \             '-)              (-'             /
          \             /                \             /
           \          .'.-.            .-.'.          /
            \         | \0|            |0/ |         /
            |          \  |   .-==-.   |  /          |
             \          `/`;          ;`\`          /
              '.._      (_ |  .-==-.  | _)      _..'
                  `"`"-`/ `/'        '\` \`-"`"`
                       / /`;   .==.   ;`\ \
                 .---./_/   \  .==.  /   \ \
                / '.    `-.__)       |    `"
               | =(`-.        '==.   ;
                \  '. `-.           /
                 \_:_)   `"--.....-'

                 file: gripper.h
                 description: Motor hardware.
                 authors: Michiel and Peter
 */

/**
 * @author Michiel
 * @author Peter
 */
#ifndef GRIPPER_H__
#define GRIPPER_H__

#include <ros/ros.h>
#include <threemxl/C3mxlROS.h>
#include <XMLConfiguration.h>
#include <threemxl/dxlassert.h>

/**
 * Class to handle motor hardware.
 */
class Gripper
{
protected:
	ros::NodeHandle nh_;	// ROS node handle
	LxSerial serial_port_;	// serial port interface

	C3mxlROS *motor_;
public:
	/**
	 * Gripper constructor.
	 */
	Gripper() : nh_("~"), motor_(NULL) {}

	/**
	 * Gripper destructor.
	 */
	~Gripper()
	{
		if(motor_)
			delete motor_;
		if(serial_port_.is_port_open())
			serial_port_.port_close();

		nh_.shutdown();
	}

	/**
	 * Init motor in the torque mode.
	 */
	void init();

	/**
	 * Return motor interface.
	 * @return	C3mxlROS*	motor interface.
	 */
	C3mxlROS *getInterfaceMotor();

};

#endif
